@extends('common')
@section('content')
    <style>
        input{
            width:130px;
        }
    </style>
    <form class="form-inline definewidth m20" action="index.html" method="get">
        教练编号：
        <input type="text" name="use_num" class="abc input-default" placeholder="如：JX20160001" pattern="^JX\d{8}$">&nbsp;&nbsp;
        姓名：
        <input type="text" name="use_name" pattern="^[\u4e00-\u9fa5]{2,10}$" class="abc input-default" placeholder="如：张三">&nbsp;&nbsp;
        身份证号：
        <input type="text" style="width:175px" name="use_card" id=""class="abc input-default" pattern="^((\d{15})|(\d{17}[0-9X]))$" placeholder="如：142730199510265689">&nbsp;&nbsp;
        手机号：
        <input type="text" name="use_phone" pattern="^1[3-9]\d{9}$" class="abc input-default" placeholder="如：13872951234">&nbsp;&nbsp;
        教练组：
        <select name="gro_id" style="width:90px">
            @foreach($gro_info as $v)
            <option value="{{$v['coa_id']}}">{{$v['coa_group']}}</option>
            @endforeach
        </select>&nbsp;&nbsp;
        &nbsp;&nbsp;
        <span style="float: right;"><button type="button" class="btn btn-primary" id="search">查询</button>&nbsp;
        <button type="button" class="btn btn-success">导出</button>
            </span>
    </form>
    <div id="tab">
    <table class="table table-bordered table-hover definewidth m10" >
        <thead>
        <tr>
            <th>序号</th>
            <th>编号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>身份证号</th>
            <th>出生年月</th>
            <th>教练证编号</th>
            <th>教练证有效期</th>
            <th>合同结束日期</th>
            <th>联系电话</th>
            <th>教练组别</th>
        </tr>
        </thead>
        @foreach($coa_info['data'] as $k=>$v)
        <tr>
            <td>{{$k+1}}</td>
            <td>{{$v['use_num']}}</td>
            <td>{{$v['use_name']}}</td>
            <td>@if($v['use_sex']==1){{"男"}}@else{{"女"}}@endif</td>
            <td>{{$v['use_card']}}</td>
            <td>{{$v['use_birthday']}}</td>
            <td>{{$v['pac_number']}}</td>
            <td>{{$v['pac_initialend']}}</td>
            <td>{{$v['use_contractend']}}</td>
            <td>{{$v['use_phone']}}</td>
            <td>{{$v['coa_group']}}</td>
        </tr>
        @endforeach
    </table>
        <div class="inline pull-right page">
            {{$coa_info['total']}} 条记录 {{$coa_info['current_page']}}/{{$coa_info['last_page']}} 页
            <a href="{{url('/execu/coachinfo')}}?page=1&&s_data={{$s_data}}">第一页</a>
            @if($coa_info['current_page']>5)
                <a href='{{url('/execu/coachinfo')}}?page={{$num['min']-5}}&&s_data={{$s_data}}' >上5页</a>
            @endif
            <a href="{{url('/execu/coachinfo')}}?page={{$coa_info['current_page']-1<1?1:$coa_info['current_page']-1}}&&s_data={{$s_data}}">上一页</a>
            @for($i=$num['min'];$i<=$num['max'];$i++)
                @if($i ==$coa_info['current_page'])
                    <a href="{{url('/execu/coachinfo')}}?page={{$i}}&&s_data={{$s_data}}" class='current'>{{$i}}</a>
                @else
                    <a href="{{url('/execu/coachinfo')}}?page={{$i}}&&s_data={{$s_data}}">{{$i}}</a>
                @endif
            @endfor
            <a href="{{url('/execu/coachinfo')}}?page={{$coa_info['current_page']+1>$coa_info['last_page']?$coa_info['last_page']:$coa_info['current_page']+1}}&&s_data={{$s_data}}">下一页</a>
            @if($coa_info['last_page']>5&&$coa_info['current_page']<=ceil($coa_info['last_page']/5-1)*5)
                <a href='{{url('/execu/coachinfo')}}?page={{$num['max']+1}}&&s_data={{$s_data}}' >下5页</a>
            @endif
            <a href="{{url('/execu/coachinfo')}}?page={{$coa_info['last_page']}}&&s_data={{$s_data}}" >最后一页</a>
        </div>
    </div>
    <script>
        $(document).ready(function(){
            $("#search").click(function(){
                $(this).attr('disabled','true');
                var url="{{ url('/execu/coachinfo') }}";
                $.get(url,$('form').serialize(),
                        function(data){
                            //alert(data);
                            $("#tab").html(data);
                            $("#search").removeAttr('disabled');
                        });
            });
        });
    </script>
@stop